<?php
/**
 * Created by PhpStorm.
 * User: administrator
 * Date: 2016/7/28 0028
 * Time: 14:18
 */
namespace Home\Controller;
use Think\Controller;

class ProUpdateController extends Controller{

    public function pro_update(){
        
        $title = I('title');
        if(empty($title)){
          exit;
        }

        $this->write_file_jxc_ftp('title',$title);

        $entity=M('updatefiles')->where(array('title'=>$title))->find();

        $exe_version=$entity['ver'];//版本号

        $file_name=$entity['filename'];//文件名称

        $download_url=_get_Host_Name().'/Uploads/Download/program/'.$file_name;//下载路径

        echo  $exe_version.'|'.$download_url.'|'.$file_name;
        exit;

    }


    /*
 * 生成日志文件
 * $pay_type 日志文件名称
 * $content 日志内容
 */
    function write_file_jxc_ftp($pay_type,$content){
        $filename =$_SERVER['DOCUMENT_ROOT']. '/Data/'.$pay_type.date('Y-m-d').'.txt';
        $Ts=fopen($filename,"a+");
        fputs($Ts,"\r\n".date('Y-m-d H:i:s',time()).' - '.$content);
        fclose($Ts);
    }


}